n.maxIeUrlLength&&(this._currentShortLink==null,this._currentShortlinkEntitiesHash=null,i()),pt.downloadJson(o,"permalink",function(n){r||u||(f._currentShortLink=n.d,f._currentShortlinkEntitiesHash=f._getLinkEntitiesHash());t&&t(n.d,f._longLinkBase+e)},function(){f._currentShortLink==null;f._currentShortlinkEntitiesHash=null;n.instLog(st.SEW,{SL:o,ERR:6});i&&i()}),n.instLog(st.GSL,{SL:o})):t&&t(this._currentShortLink)},n.prototype.isShorteningAvailable=function(){if(this._permalinkEntities!==null){var t=n.getShortenServiceUrl(this._constructCurrentQueryParams());if(t.length<=n.maxIeUrlLength)return!0}return!1},n.prototype.getPermalinkParts=function(){return this._permalinkEntities},n.prototype.getCurrentLink=function(t,i,r){var v=this,o,s,l,a,p,y,w;if(!this._permalinkEntities)throw new Error("initial permalink hasn't been requested yet.");if(this._sharingConfig.currentSchemaVersion===2&&this._currentPermalinkEntitiesHash!==this._getLinkEntitiesHash()){o={};t&&(s=t.getMode(),s&&(o["mode"+s.mapModeType]=s.getState()));var f=this._taskManager.getStacks(),e={focusedStackIndex:-1,stacks:[],isFocusedStackInCollapsedState:!1},b=this._taskManager.getFocusedStack(),h=void 0,c=f?f.length:0;for(c>1&&(l=f[c-1].getForegroundTask(),!l||l.type!=="CollectionsTask"||l.isPublicCollection&&l.isPublicCollection()||(f[c-2].displayState.isHidden=!1,f[c-2].getForegroundTask().displayState.isHidden=!1,f[c-2].getForegroundTask().displayState.activationState=1)),a=0,p=f.length;a1&&(k=a[1]);tt={FN:d,PSD:nt,RF:k};n.instLog(st.PSS,tt)}},n.instLog=function(n,t){var i={logData:{feature:dt.Share,action:st[n],data:t},isMapsAction:n!==st.EC};g.invokeHandler(w.instrumentationDataHandlerKey,i)},n.prototype._getFeatureLoggingCode=function(n){switch(n){case o.collectionsTask:return dt.Collections;case o.directionsTask:return dt.Directions;case o.localDetailsTask:case o.localListingTask:case o.localSearchTask:return dt.Search;default:return""}},n.prototype._getMapModeLoggingType=function(n){switch(n){case 0:return"CM";case 1:return"OS";case 2:return"SS";default:return""}},n.prototype._constructCurrentQueryParams=function(t){var o="",a="",v="",s=null,h=Object.keys(this._permalinkEntities),f,e,c,u,i;if(this._permalinkEntities[n.osidQueryParamName])o+=(o.length?"&":"")+n.osidQueryParamName+"="+this._permalinkEntities[n.osidQueryParamName].partValue;else for(f=h.length-1;f>=0;f--)e=this._permalinkEntities[h[f]],e.isEnabled&&(o+="&"+e.partValue+(e.title?"&"+e.title:""),s||(s=h[f]));var y=this._taskManager.getFocusedStack(),p=y&&y.getForegroundTask(),l=p&&this._permalinkEntities[p.id],r=null;l&&l.isEnabled?r=l:s&&(r=this._permalinkEntities[s]);c=null;r&&r.partValue&&(u=r.partValue.split("="),u.length===2&&(c=/\d+/i.exec(u[0])[0],a=decodeURIComponent(decodeURIComponent(u[1]))),r.title&&(u=r.title.split("=")),u.length===2&&(v="&tt="+u[1]));c&&(this._queryConstants=this._queryConstants.replace(/ftst=\d+/i,"ftst="+c));i=a+v;h.length>0&&(i+=o);i+=this._queryConstants;switch(t){case 1:i=i.replace(/form=[a-z0-9]+/i,"form="+n.facebookFormCode);break;case 2:i=i.replace(/form=[a-z0-9]+/i,"form="+n.twitterFormCode)}return i},n.maxIeUrlLength=2083,n.maxAllowedSharingLinkLength=n.maxIeUrlLength-128,n.osidQueryParamName="osid",n.facebookFormCode="LMLTFB",n.twitterFormCode="LMLTTW",n}(),to=function(){function n(n,t,i){var r=this;this._serializableComponents={};this._window=n;this._map=i;t.instanceAsync("Permalink",function(n){r._permalink=n;r._permalink.setRequestCompatibilityParams(!0)});this._historyUrl=this._originalUrl=this._window.location.toString();this._currentUrlPath=this._originalUrlPath=this._window.location.pathname;this._setDevParams();this._isOnOverlay=e._isLargeMapShownOnSerp();this._history=new hu(n);this._history.statechanged.add(function(n){return r._processStateChange(n)});e._isSmallMapShownOnSerp()||(this._pageLoadStateDictionary=this._history.getState());this._serializableObjectChanged=new tt;this._serializableObjectChanged.addThrottled(function(n){return r._processObjectChange(n)},300,function(n,t){var i=t;return i&&i.magnitude===2||(i=n),i})}return n.prototype.register=function(n,t){var i=this;if(!n||!t||this._serializableComponents[n])throw new Error("Invalid or Duplicate Key passed for registration: "+n);return this._serializableComponents[n]=t,t.serializableObjectChanged.add(function(n){return i._raiseSerializationChanged(n)}),this._pageLoadStateDictionary&&this._pageLoadStateDictionary[n]&&t.deserialize(this._pageLoadStateDictionary[n]),!0},n.prototype.unregister=function(n){if(!n||!this._serializableComponents[n])throw new Error("Invalid key passed for registration: "+n);delete this._serializableComponents[n]},n.prototype.getHistoryState=function(){return this._history.getState()},n.prototype.doesLocalStorageStateExist=function(){var n=this._history.getLocalStorageState(),t;if(!n)return!1;for(t in n)if(n.hasOwnProperty(t))return!0;return!1},n.prototype.processLocalStorageState=function(){var n=this._history.getLocalStorageState();n&&this._processStateChange(n)},n.prototype.clearLocalStorageState=function(){this._history.clearLocalStorageState()},n.prototype._raiseSerializationChanged=function(n){this._ignoreSerializationEvents||this._serializableObjectChanged.invoke(n)},n.prototype.setIsCapturing=function(n){this._ignoreSerializationEvents=!n},n.prototype.nextHistoryPointReplace=function(){this._nextHistoryPointReplace=!0},n.prototype.updateAddressBar=function(n,t){var i=this._window.location,r;this._currentUrlPath=n;r=i.toString().replace(i.pathname,n);this._historyUrl=r;this._isOnOverlay=e._isLargeMapShownOnSerp();t&&this._history.replaceState(this._history.getState(),this._historyUrl)},n.prototype._processStateChange=function(n){var t,i;this._ignoreSerializationEvents=!0;this._pageLoadStateDictionary=null;this._reloadPageToHandleUrlChange();n=n||{};for(t in this._serializableComponents)this._serializableComponents.hasOwnProperty(t)&&(i=n[t]||{},this._serializableComponents[t].deserialize(i));this._updateBrowserUrl();this._ignoreSerializationEvents=!1},n.prototype._reloadPageToHandleUrlChange=function(){var n=this._window.location.toString();ft.enableUpdateUrlParams?this._currentUrlPath===this._window.location.pathname||this._isOnOverlay||this._window.location.reload():this._historyUrl===n||this._isOnOverlay||this._isOnlyChatParamDiff(n,this._historyUrl)||this._window.location.reload()},n.prototype._isOnlyChatParamDiff=function(n,t){return n&&t&&decodeURI(n).replace("&showconv=1","").replace("&showconv=0","")===decodeURI(t).replace("&showconv=1","").replace("&showconv=0","")},n.prototype._processObjectChange=function(n){var t,r,u;if(!(e._isSmallMapShownOnSerp()||i.dynamicProperties.mapsOverlayClosing)||n&&n.clearHistory){this._pageLoadStateDictionary=null;t={};for(r in this._serializableComponents)u=this._serializableComponents.hasOwnProperty(r)&&this._serializableComponents[r].serialize(),u&&(t[r]=u);ft.enableUpdateUrlParams&&this._updateUrlWithTaskParams();n&&n.clearHistory?this._history.clearState():n&&n.magnitude===2?this._nextHistoryPointReplace?(this._nextHistoryPointReplace=!1,this._history.replaceState(t,this._historyUrl)):this._history.pushState(t,this._historyUrl):this._history.replaceState(t,this._historyUrl);this._updateBrowserUrl()}},n.prototype._updateBrowserUrl=function(){ft.updateUrlDynamically&&this._requestPermalinkWithRetries({ts:Date.now(),isFullFilled:!1},0)},n.prototype._updateUrlWithTaskParams=function(){var t=this._serializableComponents.hasOwnProperty("TaskManager")&&this._serializableComponents.TaskManager,i,n,r;t&&(i=t,n=i.getFocusedStack(),n?(r=n.getTaskUrlParams(),this._historyUrl=this._window.location.origin+"/maps?"+r):this._historyUrl=this._window.location.origin+"/maps?",this._devParams&&(this._historyUrl+=this._devParams))},n.prototype._requestPermalinkWithRetries=function(n,t){var i=this;this._permalink&&(this._lastUrlUpdateRequestTS=n,this._permalink.getGeneralPermalink(this._map,function(t){n.ts=i._lastUrlUpdateRequestTS.ts&&i._requestPermalinkWithRetries(n,t+1)},"URlUpdate"))},n.prototype._setDevParams=function(){var n=ft.devParamsList,u="",t,f,i,r;if(n&&n.length){for(t=0,f=n.length;t0&&this._history.go(-1*this._historyIndex);this._historyIndex=0},n.prototype.getLocalStorageState=function(){return rt.isEnabled()?JSON.parse(rt.getItem(n.historyLocalStorageKey)):null},n.prototype.clearLocalStorageState=function(){this._setLocalStorageMapState({})},n.prototype._setLocalStorageMapState=function(t){rt.isEnabled()&&rt.setItem(n.historyLocalStorageKey,JSON.stringify(t))},n.prototype._invokeStateChanged=function(){if(!i.dynamicProperties.mapsOverlayClosing){if(!(this._history instanceof ri))try{var n=this._history.state;this._historyIndex=n?n.index:0}catch(t){Microsoft.Maps.logger&&Microsoft.Maps.logger.logCriticalError(t);this._historyIndex=0}this.statechanged.invoke(this.getState())}},n.historyLocalStorageKey="BingMapsState",n}(),eh=function(){function n(){}return n}(),io=function(){function n(){}return n.getImageFromCss=function(t){var i=n._cachedImages.getItem(t);return i||(i=e._getImageFromCss(t),n._cachedImages.addItem(t,i)),i},n.prototype.dispose=function(){n._cachedImages.clear()},n._cachedImages=new vi(10),n}(),ro=function(){function n(n,t){this._callback=n;this._options={expansionDeceleration:.0008,rotationalDeceleration:.0008,linearDeceleration:.0023};t&&this.setOptions(t)}return n.prototype.setOptions=function(n){if(typeof n.expansionDeceleration!="undefined"){if(n.expansionDeceleration<=0)throw new Error("The 'expansionDeceleration' argument must be positive");this._options.expansionDeceleration=n.expansionDeceleration}if(typeof n.rotationalDeceleration!="undefined"){if(n.rotationalDeceleration<=0)throw new Error("The 'rotationalDeceleration' argument must be positive");this._options.rotationalDeceleration=n.rotationalDeceleration}if(typeof n.linearDeceleration!="undefined"){if(n.linearDeceleration<=0)throw new Error("The 'linearDeceleration' argument must be positive");this._options.linearDeceleration=n.linearDeceleration}},n.prototype.getOptions=function(){return this._options},n.prototype.start=function(n,t){var i=this;this.stop();this._currentVelocities={angularVelocity:t.angularVelocity,expansionVelocity:t.expansionVelocity,linearVelocity:t.linearVelocity};this._pointerTrails=n;this._animationId=u.Effects.Animation.requestAnimationFrame(function(){return i._onTick()})},n.prototype.stop=function(){this._currentVelocities&&(u.Effects.Animation.cancelAnimationFrame(this._animationId),this._currentVelocities=null,this._callback&&this._callback(null,this._pointerTrails,null),this._pointerTrails=null)},n.prototype._onTick=function(){var s=this,t,f,i,e,r,o;this._currentVelocities&&(t=y.getMagnitudeOfVector2D(this._currentVelocities.linearVelocity),f=y.getAngleOfVector2D(this._currentVelocities.linearVelocity),t-=this._options.linearDeceleration*n._tickInterval,t=Math.max(t,0),this._currentVelocities.linearVelocity=y.getVector2DFromMagnitudeAndDirection(t,f),i=Math.abs(this._currentVelocities.angularVelocity),e=this._currentVelocities.angularVelocity>=0?1:-1,i-=this._options.rotationalDeceleration*n._tickInterval,i=Math.max(i,0),this._currentVelocities.angularVelocity=i*e,r=Math.abs(this._currentVelocities.expansionVelocity),o=this._currentVelocities.expansionVelocity>=0?1:-1,r-=this._options.expansionDeceleration*n._tickInterval,r=Math.max(r,0),this._currentVelocities.expansionVelocity=r*o,this._callback&&this._callback(this._currentVelocities,this._pointerTrails,n._tickInterval),t<.001&&i<.001&&r<.001?this.stop():u.Effects.Animation.requestAnimationFrame(function(){return s._onTick()}))},n._tickInterval=16,n}(),uo=function(){function r(n,t,r){this._events=[];this._map=n;this._disposables=[];this._container=r;this._coreConfig=t;this.landmarksAllDataSourcePromise=new nu;this._layerPromise=new nu;this._infoboxOptions={showCloseButton:!1,showPointer:!1,visible:!1,htmlContent:null,location:null,autoAlignment:!0,offset:new p(10,10)};this._coupoiLandmarksDisplayed={};var f=n.getMapOptions(),u=i.features.xsr;this._retireLandmarks=u&&u.retiredLandmarks&&!f.disableRetiredLandmarks}return r.prototype.initialize=function(){var t=this,r=new yf(function(n){var r=[{name:"LandmarksDataSource",args:t._coreConfig},{name:"LandmarksOSDataSource",args:t._coreConfig}],u=t._map.getMapOptions(),f=i.features.landmarks3D;f&&f.isEnabled&&u&&u.show3dLandmarks&&r.push({name:"Landmarks3DDataSource",args:t._coreConfig},{name:"Landmarks3D",args:t._coreConfig});t._retireLandmarks&&r.push({name:"TaskManager"});t._container.instanceAsyncAll(r,n)});r.getObjectAsync(function(i){var r,u;t._landmarksDataSource=i.LandmarksDataSource;t._landmarksOSDataSource=i.LandmarksOSDataSource;t._landmark3DDataSource=i.Landmarks3DDataSource;t._landmarks3DManager=i.Landmarks3D;t._layerDataSource=t._landmarksDataSource.getLayerDataSource(t._coreConfig.landmarksVectorLayerId);t._layerOSDataSource=t._landmarksOSDataSource.getLayerDataSource(t._coreConfig.landmarksVectorLayerId);r=t._map.getMapType().id;r!==n.birdseye&&r!==n.birdseyeV2&&r!==n.streetside&&t._setDataSourceLayer();t._taskManager=i.TaskManager;t._taskManager&&(u=function(){var n=t._taskManager.getStacks(),i=n&&n.length>0;i!==t._managerHasTasks&&(t._managerHasTasks=i,t._onMapLayersChanged(null))},t._disposables.push(t._taskManager.newStackListCreated.add(u),t._taskManager.stackAdded.add(u),t._taskManager.stackRemoved.add(u)));t.landmarksAllDataSourcePromise.resolve({landmarksDS:t._landmarksDataSource,landmarksOSDS:t._landmarksOSDataSource,landmarks3DDS:t._landmark3DDataSource})});this._disposables.push(this._map.mapTypeChanged.add(function(i){t.landmarksAllDataSourcePromise.then(function(r){t._layer&&(i.newMapTypeId===n.ordnanceSurvey?t._layer.setDataSource(r.landmarksOSDS):t._layer.setDataSource(r.landmarksDS))})}))},r.prototype._initMapsInfobox=function(){var n=this;this._mapsInfoboxPromise||(this._mapsInfoboxPromise=new Promise(function(t){n._map.getContainer().instanceAsync("MapsInfobox",function(i){n._currentInfobox=i;n._currentInfobox.setMap(n._map);n._events.push(n._currentInfobox.changed.add(function(t){t&&t.name==="htmlContent"&&n._registerInfoboxClickHandler(n._currentInfobox.getPrimitive())}));t(i)},{location:n._infoboxOptions.location||n._map.getView().cameraLocation,options:n._infoboxOptions})}))},r.prototype._setDataSourceLayer=function(){var n=this;this.landmarksAllDataSourcePromise.then(function(t){n._layer||n._addLayer(t)})},r.prototype._addLayer=function(t){var i=this,r;this._layer||(this._layer=this._map.getMapType().id===n.ordnanceSurvey?new wt(this._coreConfig.landmarksLayerId,this._layerOSDataSource,this,this._coreConfig.landmarksLayerZIndex):new wt(this._coreConfig.landmarksLayerId,this._layerDataSource,this,this._coreConfig.landmarksLayerZIndex),this._layer.setRenderTarget(1),this._layer.canBeFiltered=!0,t.landmarksOSDS.setLayer(this._layer),t.landmarksDS.setLayer(this._layer),r=this._map.getLayers(),r.insert(this._layer),this._layer.setVisible(!0),t.landmarks3DDS&&this._landmarks3DManager&&this._landmarks3DManager.addLayer(t.landmarks3DDS),this._primitiveTapped=this._layer.primitiveTapped.add(function(n){i._onPrimitiveTapped(n)}),this._primitiveHoverStarted=this._layer.primitiveHoverStarted.add(function(n){i._onPrimitiveHoverStarted(n)}),this._primitiveHoverStopped=this._layer.primitiveHoverStopped.add(function(n){i._onPrimitiveHoverStopped(n)}),this._events.push(this._map.mapTypeChanged.add(function(n){i._onMapTypeChanged(n)}),r.changed.add(function(n){i._onMapLayersChanged(n)})),this._layer.overlayEvent=2,this._layerPromise.resolve(this._layer))},r.prototype.addInfoboxClickHandler=function(n){var t=this;this._initMapsInfobox();this._mapsInfoboxPromise.then(function(){t._currentInfobox.click.add(n)})},r.prototype.addLandmarkClickHandler=function(n){var t=this;this._layerPromise.then(function(){t._layer.primitiveTapped.add(n)})},r.prototype.addInfoboxHoverHandler=function(n){var t=this;this._initMapsInfobox();this._mapsInfoboxPromise.then(function(){t._currentInfobox.mouseenter.add(n)})},r.prototype.addLandmarkHoverHandler=function(n){var t=this;this._layerPromise.then(function(){t._layer.primitiveHoverStarted.add(n)})},r.prototype.addInfoboxHoverEndHandler=function(n){var t=this;this._initMapsInfobox();this._mapsInfoboxPromise.then(function(){t._currentInfobox.mouseleave.add(n)})},r.prototype.addLandmarkHoverEndHandler=function(n){var t=this;this._layerPromise.then(function(){t._layer.primitiveHoverStopped.add(n)})},r.prototype.add3dLandmarkHoverHandler=function(n){var t=this;this._layerPromise.then(function(){t._landmarks3DManager.layer.primitiveHoverStarted.add(n)})},r.prototype.add3dLandmarkHoverEndHandler=function(n){var t=this;this._layerPromise.then(function(){t._landmarks3DManager.layer.primitiveHoverStopped.add(n)})},r.prototype.add3dLandmarkClickHandler=function(n){var t=this;this._layerPromise.then(function(){t._landmarks3DManager.layer.primitiveTapped.add(n)})},r.prototype._onMapLayersChanged=function(n){var r=!n||n.reset,i=this._layer,t=i&&i.getDataSource();t&&t.invalidated&&r&&t.invalidated.invoke()},r.prototype._onMapTypeChanged=function(t){if(t.newMapTypeId!==t.oldMapTypeId){this._resetTemplateSelector=!0;this._initialized=!1;this.selectorReady();var i=t.newMapTypeId!==n.birdseye&&t.newMapTypeId!==n.streetside&&t.newMapTypeId!==n.birdseyeV2;this._layer.setVisible(i)}},r.prototype._removeLayer=function(){this._layer&&(this._map.getLayers().remove(this._layer),this._layer.dispose(),this._layer=null);this.removePrimitiveTapped();this.removePrimitiveHover();this._currentInfobox&&this._currentInfobox.dispose();e._clearDisposables(this._events)},r.prototype.applyFilterOnDataSource=function(n){var r,t,u,i,f,e;if(n){for(r=this._map.getBaseLayers(),t=0;t0&&(i=n.geometry,u=null,i&&(u=new h(n.crs.toLatitude(i.bounds[1],i.bounds[0]),n.crs.toLongitude(i.bounds[1],i.bounds[0]))),l={id:r.stops[0].id,title:r.stops[0].name,location:u,activationEntryPoint:1},g.invokeHandler(w.taskDataHandlerKey,{type:o.transitStopTask,state:l}),a={Z:this._map.getMercatorZoomLevel(),TM:n.bucket,S:it.getLabelImportance(n.entity),L:u},v={logData:{feature:"TS",action:"MPC",data:a}},g.invokeHandler(w.instrumentationDataHandlerKey,v)))}},r.prototype._getRating=function(n,t){for(var r=t&&t.toLowerCase().indexOf("tripadvisor")>-1,f=r?"tartg_f sw_st":"sw_st",e=r?"tartg_hf sw_sth":"sw_sth",o=r?"tartg_e sw_ste":"sw_ste",u='',i=0;i<10;i=i+2)u+='<\/span>';return u+"<\/span><\/div><\/div>"},r.prototype._createInfoboxHtml=function(n){var h=n.ads.length,i=n.ads[0],f=i.cpc,o="",s,r;f&&(s=re.fromString(f).host,r=s&&s.split(".")||[],r.length>1&&(o="".concat(r[r.length-2],".").concat(r[r.length-1])));var c=i.category||"",u=parseInt(i.reviewCount),a=isNaN(u)?"":"(".concat(u<1e3?u.toString():(u/1e3).toFixed(1)+"k",")"),v=i.img?i.img+"&h=121&dpr="+e._getDpr():"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEX/TQBcNTh/AAAAAXRSTlMAQObYZgAAAApJREFUeJxjYgAAAAYAAzY3fKgAAAAASUVORK5CYII=",l=parseFloat(n.ads[0].bingRating);return ce.replace("{image}",v).replace("{title}",n.name||"").replace("{category}",c).replace("{morefacts}",this._getRating(l,i.ratingProvider)).replace("{price}","from ".concat(i.price)||"").replace("{adsUrl}",f||"").replace("{numdeals}",h>1?t.LandmarkDealsMore_Text.replace("{0}",h-1):"").replace("{reviewCount}",a).replace("{couponTitle}",i.title||n.name||"").replace("{duration}",this._couponAdsDuration(i.duration)).replace("{provider}",o||"").replace("{categoryOpacity}",c?"1":"0").replace("{ratingOpacity}",isNaN(l)?"0":"1").replace("{providerDisplay}",o&&i.price?"block":"none")},r.prototype._couponAdsDuration=function(n){if(n){var t=n.split(":");if(t.length===3){if(parseInt(t[0])>0)return"".concat(parseInt(t[0]),"day");if(parseInt(t[1])>0)return"".concat(parseInt(t[1]),"hr")}}return""},r.prototype._onPrimitiveHoverStarted=function(n){var t=this,r=n.primitive,u=it.getYpid(r.entity,!0),o=it.getTransitJson(r.entity),f=r.entity,s=f.landmarksDealFlag,e;if(r.entity&&(u||o||s)){if(r.viewState=1,r.zIndex=2,this._hoverStartTimeStamp=Date.now(),r.entity.changed.invoke(),o){var l=JSON.parse(o),a=this._buildTransitStaticResources(l),v={overlayTemplate:new c(eu,a),overlayAnchor:new nr(-n.point.y-10,-n.point.x-10),overlayAlignment:0};ru.showOverlay(this._map,v,r)}!u||!this._map.getMapOptions().showLandmarksInfobox&&(i.isSDK||i.isMsftPartner)||(e=r.geometry,this._infoboxOptions.location=new h(r.crs.toLatitude(e.x,e.y),r.crs.toLongitude(e.x,e.y)),this._initMapsInfobox(),this._mapsInfoboxPromise.then(function(){if(t._currentInfobox.keepVisible(!0),t._currentInfobox.setPrimitive(r),s&&t._coreConfig.landmarkDeals){delete t._infoboxOptions.entity;t._coupoiLandmarksDisplayed[u]||(t._infoboxOptions.visible=!0,t._infoboxOptions.htmlContent=le.replace("{morefacts}",t._getRating(0)),t._currentInfobox.setOptions(t._infoboxOptions));var n=t._coreConfig.landmarkDealsUrl.replace("{ypid}",u);t._landmarkDealRequestId=pt.downloadJson(n,"landmarkDeals",function(n,i){t._coupoiLandmarksDisplayed[u]=!0;var e=n.Ads;i===u&&(e&&e.length>0?(f.ads=e,f.poiType=5,t._infoboxOptions.visible=!0,t._infoboxOptions.htmlContent=t._createInfoboxHtml(f),t._currentInfobox.setPrimitive(r),t._currentInfobox.setOptions(t._infoboxOptions)):t._currentInfobox.setOptions({visible:!1}))},null,u,!1,0,null,null,df.getLogKeyFromUrl(n))}else ai&&ai.enableRichInfoBox&&t._map.getMapOptions().showLandmarksInfobox&&(f.poiType=5,t._infoboxOptions.entity=f,t._infoboxOptions.visible=!0,t._currentInfobox.setOptions(t._infoboxOptions))}))}},r.prototype._onPrimitiveHoverStopped=function(n){var t=n.primitive,i=t.entity;if(i){pt.abortRequest(this._landmarkDealRequestId);var f=it.getYpid(i),u=it.getTransitJson(i),e=t.entity.landmarksDealFlag;(f||u||e)&&(t.viewState=0,t.zIndex=0,this._hoverStartTimeStamp&&Date.now()-this._hoverStartTimeStamp>=r._hoverLoggingThresholdForEventLogging&&this._log("L","H",t,null,Date.now()-this._hoverStartTimeStamp),this._hoverStartTimeStamp=null,t.entity.changed.invoke(),u&&ru.hideOverlay(this._map,t),this._currentInfobox&&(this._currentInfobox.keepVisible(!1,t),this._currentInfobox.setOptions({visible:!1,closeDelayTime:500})))}},r.prototype._onPrimitiveTapped=function(n){var t=n.primitive,i=it.getYpid(t.entity);(t.entity&&i||it.getTransitJson(t.entity))&&this._selectPoi(t,2)},r.prototype._registerInfoboxClickHandler=function(n){var r=this,i=u(".infoBoxLink");i.length>0&&(i.set_attr("aria-label",t.InfoboxListAriaLabel),i.set_style({cursor:"pointer"}),i.add_event("click",function(t){var u=t.target&&t.target.id==="adsLink",i;(u&&r._log("LD","C",n,t.target.href),i=t.target&&t.target.classList.contains("cbtn")&&t.target.classList.contains("b_noTarget"),i)||n.entity&&(r._selectPoi(n,2),r._currentInfobox.setOptions({visible:!1}))}))},r.prototype.dispose=function(){this._coupoiLandmarksDisplayed=null;this._removeLayer();this._landmarks3DManager&&(this._landmarks3DManager.dispose(),this._landmarks3DManager=null);e._clearDisposables(this._disposables);e._nullifyClass(this)},r.prototype._buildTransitStaticResources=function(n){var o="",s="",u=[],h=0,f=!1,i,t,r,e;if(n&&n.stops&&n.stops.length&&(s=n.stops[0].name,n.stops[0].routes&&n.stops[0].routes.length)){for(i=n.stops[0].routes,t=0;t5&&h++,u.push(e);f=h>=u.length/2;o=u.join(f?"\n":", ")}return{transitLandmark:n,routeList:o,showLongList:f,stopName:s,addNewLines:this._addNewLines}},r.prototype._addNewLines=function(n){return n?"enableNewLines":""},r.prototype._log=function(n,t,i,r,u){var o=it.getYpid(i.entity),f=i.geometry,s=null,e,c;f&&(s=new h(i.crs.toLatitude(f.bounds[1],f.bounds[0]),i.crs.toLongitude(f.bounds[1],f.bounds[0])));e=null;o&&(e={ID:o,Z:this._map.getMercatorZoomLevel(),L:s,CP:i.entity&&i.entity.landmarksDealFlag?"1":"0"},u&&(e.HD=u),r&&(e.dealsUrl=r));c={logData:{feature:n,action:t,data:e}};g.invokeHandler(w.instrumentationDataHandlerKey,c)},r._hoverLoggingThresholdForEventLogging=500,r}(),fo=function(){function n(n){this._primitives=[];this._changedEventHandlers=[];this.invalidated=new tt;n&&this.addPrimitives(n)}return n.prototype.addPrimitive=function(n){this.addPrimitives([n])},n.prototype.addPrimitives=function(n){for(var t,r=new ci,i=0;i0,"Cannot call getLast when the trail is empty."),this._deltaList[this._deltaList.length-1]},n.prototype.getLastExcluding=function(n){a.assert(this._deltaList.length>0,"Cannot call getLastExcluding when the trail is empty.");for(var t=this._deltaList.length-1;t>=0&&pi.areEqual(this._deltaList[t],n);)--t;return t>=0?this._deltaList[t]:null},n.prototype.getLastN=function(n){return this._deltaList.slice(-n)},n.prototype.isEmpty=function(){return this._deltaList.length===0},n}(),oh=function(){function n(){}return n}(),oo=function(){function n(){this.reset()}return n.prototype.reset=function(){this._activeKeyCodes={}},n.prototype.processKeyDownEvent=function(n){var t=n.originalArgs;t&&(t.altKey||t.ctrlKey||t.metaKey)||(this._activeKeyCodes[n.keyCode]=!0)},n.prototype.processKeyUpEvent=function(n){this._activeKeyCodes[n.keyCode]=!1},n.prototype.isKeyPressed=function(n){return this._activeKeyCodes[n]},n.prototype.isPanUpRequested=function(){return this._activeKeyCodes[38]&&!this._activeKeyCodes[40]},n.prototype.isPanDownRequested=function(){return this._activeKeyCodes[40]&&!this._activeKeyCodes[38]},n.prototype.isPanLeftRequested=function(){return this._activeKeyCodes[37]&&!this._activeKeyCodes[39]},n.prototype.isPanRightRequested=function(){return this._activeKeyCodes[39]&&!this._activeKeyCodes[37]},n.prototype.isPanOperationRequested=function(){return this.isPanUpRequested()||this.isPanDownRequested()||this.isPanLeftRequested()||this.isPanRightRequested()},n.prototype.isZoomInRequested=function(){var n=this._activeKeyCodes,t=n[187]||n[107],i=n[189]||n[109];return t&&!i},n.prototype.isZoomOutRequested=function(){var n=this._activeKeyCodes,t=n[187]||n[107],i=n[189]||n[109];return i&&!t},n.prototype.isZoomOperationRequested=function(){return this.isZoomInRequested()||this.isZoomOutRequested()},n.prototype.isMapTypeSwitchRequested=function(){var n=this._activeKeyCodes;return n[65]||n[66]||n[69]||n[72]||n[79]||n[82]||n[83]},n.prototype.isNavigationRequested=function(){return this.isPanOperationRequested()||this.isZoomOperationRequested()},n}(),v=function(){function n(){}return n.ActionBubbleChanged="BC",n.BubbleLocation="BL",n.BubbleChangedMethod="BCM",n.BubbleChangedMethodArrow="Arrow",n.BubbleChangedMethodOverviewMap="OverviewMap",n.BubbleChangedMethodOverviewMapPoi="OverviewMapPoi",n.BubbleChangedMethodTapAndHold="TapAndHold",n.BubbleChangedMethodKeyboard="Keyboard",n.EntryPoint="EP",n.EntryPointZoomIn="ZoomIn",n.EntryPointStreetsideMini="StreetsideMini",n.EntryPointCoverageMap="CoverageMap",n.EntryPointDrivingDirections="DrivingDirections",n.EntryPointLocalDetails="LocalDetails",n.EntryPointPermalink="Permalink",n.EntryPointBrowserHistory="BrowserHistory",n.ExitMethod="EM",n.ExitMethodEscKey="EscKey",n.ExitMethodExitButton="ExitButton",n.ExitMethodExternal="External",n.NumberBubblesNavigated="NBN",n.OverviewMapActivated="OMA",n.OverviewMapDeactivated="OMD",n.OriginUser="User",n.OriginEvent="Event",n.PhotosynthModeFeatureName="PS",n.StreetsideModeFeatureName="SS",n.StreetsideMiniFeatureName="SM",n.StreetsideErrorAction="E",n.StreetsideBootstrapError="BE",n}(),bt=function(){function n(){}return n.CoverageLayerDisplayTime=v.StreetsideModeFeatureName+"_CLD",n.AutoEntryToImmersionTime=v.StreetsideModeFeatureName+"_AEI",n.CoverageLayerClickToImmersionTime=v.StreetsideModeFeatureName+"_CLCI",n.LocalDetailsClickToImmersionTime=v.StreetsideModeFeatureName+"_LDCI",n.DirectionsClickToImmersionTime=v.StreetsideModeFeatureName+"_DCI",n.StreetsideMiniClickToImmersionTime=v.StreetsideModeFeatureName+"_SMCI",n.ContextMenuClickToImmersionTime=v.StreetsideModeFeatureName+"_CMCI",n.PermalinkToImmersionTime=v.StreetsideModeFeatureName+"_PCI",n.BrowserHistoryToImmersionTime=v.StreetsideModeFeatureName+"_BHCI",n.LaunchToReadyTime=v.StreetsideModeFeatureName+"_LR",n.DirectionsIntegrationTime=v.StreetsideModeFeatureName+"_DI",n.LocalDetailsIntegrationTime=v.StreetsideModeFeatureName+"_LDI",n.UpdateOverviewMapTime=v.StreetsideModeFeatureName+"_UOM",n.OpenOverviewMapTime=v.StreetsideModeFeatureName+"_OOM",n.CloseOverviewMapTime=v.StreetsideModeFeatureName+"_COM",n.Succeeded="s",n.Failed="f",n}(),so=function(){function r(n,t){this._map=null;this._noCoverage=!1;this._perfLog=t;this._bubbleLookupInProgress=!1;this._streetsideBubblePickerOverlay=null}return r.prototype.isAttached=function(){return!(this._map===null)},r.prototype.attach=function(n,t){var i=this;a.assert(!this._map,"An event source has already been attached to this behavior.");this._map=n;this._createStreetSideCoverageLayer();t?(this._streetsideBubblePickerOverlay=t.pickerOverlay,this._attachedTo=t.attachedTo,this._entryPoint=t.entryPoint,this._perfIdentifier=t.perfIdentifier,this._followCursor=t.followCursor,this._insertOverlays(),this._attachKeyHandler(),r._log("A",this._entryPoint)):this._map.getContainer().instanceAsync("StreetsideBubblePickerOverlay",function(n){i._streetsideBubblePickerOverlay=n;i._attachedTo="StreetsideCoverageBehavior";i._entryPoint=v.EntryPointCoverageMap;i._perfIdentifier=bt.CoverageLayerClickToImmersionTime;i._followCursor=!0;i._insertOverlays();i._attachKeyHandler();r._log("A",i._entryPoint)})},r.prototype.detach=function(){a.assertNotNull(this._map,"No map has been attached to this behavior.");this._streetsideBubblePickerOverlay&&this._streetsideBubblePickerOverlay.showCoverage(!0);this._bubbleLookupInProgress=!1;this._map&&this._map.getOverlays()&&this._map.getOverlays().remove(this._streetsideBubblePickerOverlay);this._imageryMapLayer.setVisible(!1);this._pointerMovedHandler&&this._pointerMovedHandler.dispose();this._mapViewChangedHandler&&this._mapViewChangedHandler.dispose();this._mapTappedHandler&&this._mapTappedHandler.dispose();this._frameRenderedHandler&&this._frameRenderedHandler.dispose();this._modeChangedHandler&&this._modeChangedHandler.dispose();this._detachKeyHandler();this._pointerMovedHandler=null;this._mapViewChangedHandler=null;this._mapTappedHandler=null;this._frameRenderedHandler=null;this._modeChangedHandler=null;this._streetsideBubblePickerOverlay=null;this._attachedTo=null;this._perfIdentifier=null;this._map=null;r._log("D",this._entryPoint);this._entryPoint=null},r.prototype.getAttachedTo=function(){return this._attachedTo},r.prototype.toggleStreetsideButton=function(n){if(this._map){var t=u(".slot.streetside"),r=this._map.getNavigationBar(),i=r&&r.getHelper();t&&t.length>0&&i&&i.isEnabled(t)&&(n&&!i.isSwitchButtonTurnedOn(t)||!n&&i.isSwitchButtonTurnedOn(t))&&i.toggleSwitch(t)}},r.prototype._attachKeyHandler=function(){var n=this;this._keyPressedHandler=function(t){t&&t.keyCode===27&&(n.toggleStreetsideButton(!1),n.detach())};u(window).add_event("keyup",this._keyPressedHandler)},r.prototype._detachKeyHandler=function(){u(window).remove_event("keyup",this._keyPressedHandler);this._keyPressedHandler=null},r.prototype._insertOverlays=function(){var n=this;this._map.getOverlays().insert(this._streetsideBubblePickerOverlay);this._imageryMapLayer.setVisible(!0);this._map.getLayers().indexOf(this._imageryMapLayer)===-1&&this._map.getLayers().insert(this._imageryMapLayer);this._followCursor||this._streetsideBubblePickerOverlay.setAlignment(this._map.getView().cameraLocation);this._map.getContainer().instanceAsync("StreetsideModeBootstrapper",function(t){return n._finalizeAttach(t)})},r.prototype._finalizeAttach=function(n){var t=this;this._map&&(this._streetsideModeBootstrapper=n,this._checkIfCoverageIsInView(null),this._followCursor?this._pointerMovedHandler=this._map.pointerMoved.add(function(n){return t._onPointerMoved(n)}):this._mapViewChangedHandler=this._map.viewChanged.add(function(n){return t._onMapViewChanged(n)}),this._mapTappedHandler=this._map.mapTapped.add(function(n){return t._onMapTapped(n)}),this._frameRenderedHandler=this._map.getFrameManager().frameRendered.add(function(n){return t._checkIfCoverageIsInView(n)}),this._modeChangedHandler=this._map.mapModeChanged.add(function(n){return t._onMapModeChanged(n)}),this._mapTypeChangedHandler=this._map.mapTypeChanged.add(function(){return t._onMapTypeChanged()}))},r.prototype._onMapModeChanged=function(n){n.newMode===2&&this.toggleStreetsideButton(!1);this.detach()},r.prototype._onMapTypeChanged=function(){this._map&&this._map.getMapType().id===n.birdseye&&this.detach()},r.prototype._checkIfCoverageIsInView=function(){var n=this;this._streetsideModeBootstrapper.isAvailable(this._map.getBounds(),function(t){return n._handleIsAvailableResponse(t)},function(){return n._noBubblesFoundInMapView()})},r.prototype._onPointerMoved=function(n){this._streetsideBubblePickerOverlay.setAlignment(n.location)},r.prototype._onMapViewChanged=function(){this._streetsideBubblePickerOverlay&&this._streetsideBubblePickerOverlay.setAlignment(this._map.getView().cameraLocation)},r.prototype._onMapTapped=function(n){var u=this,i,r,t;!n||n.exclusiveHitTest||this._bubbleLookupInProgress||this._noCoverage||(this._bubbleLookupInProgress=!0,i=this._map.getMode().tryPointToLocation(n.point),i&&(this._streetsideBubblePickerOverlay.showWaiting(),r=this._perfLog.start(this._perfIdentifier),t=this._map.getMapOptions().streetsideOptions||{},t.zoomIn=!0,t.entryPoint=this._entryPoint,t.perfState=r,this._streetsideModeBootstrapper.isAvailable(i,function(n){u._streetsideModeBootstrapper.show(n,t)},function(){return u._noBubblesFound(r)},t)))},r.prototype._noBubblesFound=function(n){var i=this;this._bubbleLookupInProgress=!1;this._streetsideBubblePickerOverlay&&this._streetsideBubblePickerOverlay.showNoCoverage(t.L_StreetsideNoCoverageInstructions_Text);Microsoft.Maps.setTimeout(function(){i._streetsideBubblePickerOverlay&&i._streetsideBubblePickerOverlay.showCoverage()},l.cursorSwapDelayTimeInMilliseconds);n&&n.end(bt.Failed)},r.prototype._handleIsAvailableResponse=function(n){n?(this._noCoverage=!1,this._streetsideBubblePickerOverlay&&this._streetsideBubblePickerOverlay.showCoverage()):this._noBubblesFoundInMapView()},r.prototype._noBubblesFoundInMapView=function(){this._noCoverage=!0;this._streetsideBubblePickerOverlay&&this._streetsideBubblePickerOverlay.showNoCoverage(i.isMobile?t.L_StreetsideMobileNoCoverageInMapView_Text:t.L_StreetsideNoCoverageInMapView_Text)},r.prototype._createStreetSideCoverageLayer=function(){if(!this._imageryMapLayer&&this._map){this._imageryMapLayer=new pf("Microsoft.Maps.StreetsideCoverage",l.coverageLayerZIndex,l.coverageLayerOpacity,null,null,2,null,this._map.getMapOptions().enableCORS);var n=e._updateTfeUrlDomain(l.coverageLayerTileUrlFormat),t=et.toScale(null,l.maxZoomForSS,!0);this._imageryMapLayer.addScene(10,ne.createMercatorImageryScene("SSCoverage",n,"",null,this._map),0,360,t)}},r._log=function(n,t){var i={feature:"SSCL",action:n,data:{EP:t}};g.invokeHandler(w.instrumentationDataHandlerKey,{logData:i})},r._defaultNumberOfBubblesToRequest=10,r}(),ht=function(){function n(){}return n.ActionName="NC",n.RotateLeft="RotateLeft",n.RotateReset="RotateReset",n.RotateRight="RotateRight",n.MapMode="MapMode",n.ZoomIn="ZoomIn",n.ZoomOut="ZoomOut",n.MyLocation="MyLocation",n.Streetside="Streetside",n.MapTraffic="MapTraffic",n}(),ni=function(){function r(n){var t=this;this.isEnabled=function(n){var t=n[0].getAttribute("class");return t.indexOf("disabled")===-1};this._map=n;this._mapRoot=this._map.getRootElement();this._isStreetsideSupported=this.isStreetsideSupported();this._isStreetsideButtonEnabled=this._isStreetsideSupported;this._mePoi=new vo(n);this._locateMeErrorDialog=new wu(n);this._disposables=[];this.streetSideExitEvent=new tt;this._disposables.push(this._map.mapModeChanged.add(function(n){return t._onMapModeChanged(n)}));this._isLabelVisible=!0;this.locateMeEvent=new tt;this._disposables.push(this.locateMeEvent.add(function(n){t._handleLocateMeEvent(n)}));this._isStreetsideSupported&&this._disposables.push(this._map.mapTypeChanged.add(function(){return t._onMapTypeChanged()}))}return r.prototype.setNavigationBar=function(n){this._navigationBar=n},r.prototype.getMap=function(){return this._map},r.prototype.getMapRoot=function(){return this._mapRoot},r.ignoreEvent=function(n){n.preventDefault()},r.prototype.rotateLeft=function(){var n=this._map.getNavigationBar();n&&n.isRotateLeftEnabled()&&(n.enableRotateLeftButton(!1),this._rotate(90),this._log(ht.RotateLeft))},r.prototype.rotateRight=function(){var n=this._map.getNavigationBar();n&&n.isRotateRightEnabled()&&(n.enableRotateRightButton(!1),this._rotate(-90),this._log(ht.RotateRight))},r.prototype.zoomIn=function(){var n=this._map.getNavigationBar();n&&n.isZoomInButtonEnabled()&&(this._zoomAroundCenterByDelta(1),this._log(ht.ZoomIn))},r.prototype.zoomOut=function(){var n=this._map.getNavigationBar();n&&n.isZoomOutButtonEnabled()&&(this._zoomAroundCenterByDelta(-1),this._log(ht.ZoomOut))},r.prototype.locateMe=function(){var n=this,t={callback:function(t){var y,e=!1,c=!1,s=0,d=n._map.getConfig(),f=i.dynamicProperties,u=null,o=null,k,p;if(t.success&&t.location&&t.position&&t.position.coords&&t.position.coords.accuracy>=0&&(s=t.position.coords.accuracy,e=s<=d.locateMeHighAccuracyMeters,c=e||!f.locationIsPreferenceBased,c&&(u=t.location,o="w3cLocation")),u||(f.locationIsPreferenceBased&&f.preferenceBasedLocation?(u=h.parseLatLong(f.preferenceBasedLocation),o="preferenceBasedLocation"):f.location?(u=h.parseLatLong(f.location),o="FDLocation"):f.reverseIPLocation?(u=h.parseLatLong(f.reverseIPLocation),o="reverseIPLocation"):f.marketLocation&&(u=h.parseLatLong(f.marketLocation),o="marketLocation"),a.assert(!!u,"Could not find any location")),u){n._mePoi.setVisible(e);var w=n._map.getActualSize(),b=Math.max(w.width,w.height),l=n._map.getMercatorZoomLevel(),v=new wf(u);v.accuracy=s;v.locationType=o;s>0&&b>0&&(l=et.fromScale(u,6*s/b,!0));l=Math.max(Math.min(l,r._locateMeMaxZoom),r._locateMeMinZoom);e&&n._mePoi.setLocation(u);k=n._map.getView().cameraLocation;p=et.toLocation(u,l,!0);h.areEqual(k,p)?e||n._locateMeErrorDialog.show(c):(e||n._map.viewChanged.addOne(function(){n._locateMeErrorDialog.show(c)}),n._map.setView(new lt(p)));((y=t.error)===null||y===void 0?void 0:y.code)>0&&(v.error=t.error.code);n.locateMeEvent.invoke(v)}}};this._geoLocationProvider||(this._geoLocationProvider=new ou(window,null));this._geoLocationProvider.GetCurrentPosition(t);this._log(ht.MyLocation)},r.prototype.toggleTraffic=function(n){n.toggle(5);this._log(ht.MapTraffic)},r.prototype.streetsideHandler=function(){var n=this;this.getMap().getContainer().instanceAsync("StreetsideModeBootstrapper",function(){g.invokeHandler(w.streetsideDataHandlerKey,{action:"toggleCoverageMap",map:n.getMap()});n._log(ht.Streetside)})},r.prototype.toggleSwitch=function(n){var t=n[0].getAttribute("class");t.indexOf(r.selectedClass)===-1?n.add_class(r.selectedClass):n.remove_class(r.selectedClass)},r.prototype.turnSwitchButtonsOff=function(){for(var i,t=this._getRadialMenuSwitchButtons(),n=0;n-1&&t[n].click()},r.prototype.isSwitchButtonTurnedOn=function(n){var t=n[0].getAttribute("class");return t.indexOf(r.selectedClass)!==-1},r.prototype.invokeMapTypeButtonClicked=function(n){var t=this._navigationBar;t&&t.mapTypeButtonClicked.invoke(n)},r.prototype._getRadialMenuSwitchButtons=function(){for(var t,i=[],r=this._mapRoot.select(".menu")[0].childNodes,n=0;n=f&&(s=f-o-e,h={"max-Height":s,"overflow-y":"scroll","overflow-x":"hidden"},t.set_style(h));i.isMapsAnswer||i.isMapsVertical||t.set_style({"margin-top":"0px"});c=this._mapRoot.select("#navbarLabelToggleInput")[0];r=this.supportLabelToggle();c.checked=r?this._map.getLabelController().getIsLabelsEnabled():!0;this.enableLabelToggleButton(r);this._disposables.push(this._map.contextMenuInvoked.add(function(){return n.hideDropDownMenu()}),this._map.mapZoomStarted.add(function(){return n.hideDropDownMenu()}),this._map.mapPanStarted.add(function(){return n.hideDropDownMenu()}),this._map.mapTapped.add(function(){return n.hideDropDownMenu()}));this._windowEventHandler||(this._windowEventHandler=function(t){return n._onWindowEvent(t)},u(window).add_event("click,touchend,keyup",this._windowEventHandler));Microsoft.Maps.setTimeout(function(){n._map.mapRadialMenuChanged.invoke(!0)},200);this._adjustSlotText()},r.prototype.supportLabelToggle=function(){var i=this._map,r=i.getMapOptions(),u=i.getMapType().id,t=!0;switch(u){case n.ordnanceSurvey:case n.mercator:t=!1;break;case n.road:case n.highContrast:case n.grayscale:case n.canvasDark:case n.canvasLight:case n.roadDark:t=r.allowHidingLabelsOfRoad}return t},r.prototype.hideDropDownMenu=function(){this._mapRoot.select(".NavBar_DropDown, .menu").remove_class("opened");this._mapRoot.select(".NavBar_Container, .NavBar_MapTypeButtonContainer").remove_class("selected");this._mapRoot.select("#RadialMenu").set_style({"max-Height":"","overflow-y":"","overflow-x":""});var t=this._map.getMapType().id;(t===n.birdseye||t===n.birdseyeV2)&&this._setRotateButtonVisible(!0);this._map.mapRadialMenuChanged.invoke(!1);this._disposeMapEvents()},r.prototype.getNavBarOrientation=function(){return this._navigationBar.getNavigationBarOrientation()},r.prototype.getNavBarMode=function(){return this._navigationBar.getNavigationBarMode()},r.prototype.isKeyUp=function(n,t){if(n&&n.type==="keyup"&&t){var i=n,r=i.keyCode||i.which;return r===t}return!1},r.prototype.setFocusOnMapLayersButton=function(){var n=this;Microsoft.Maps.setTimeout(function(){n._mapRoot.select("#MapStyleSelector")[0].focus()},20)},r.prototype.setFocusOnRadialMenu=function(){var n=this;Microsoft.Maps.setTimeout(function(){var t=n._mapRoot.select("#RadialMenu"),i=u(t[0].children&&t[0].children[0]);i&&i[0].focus()},300)},r.prototype.handleLabelsVisibleOnMapTypeChanged=function(){var t=this.supportLabelToggle(),i=!t||this.getLabelVisible(),n;this.getMap().getLabelController().setIsLabelsEnabled(i);n=this.getMapRoot().select("#navbarLabelToggleInput")[0];n&&(n.checked=i,this.enableLabelToggleButton(t))},r.prototype.checkBirdseyeV2ForDropdown=function(){var i=this,n=this._navigationBar.getRootElement().select(".slot.birdseye"),t;n&&(this.setMapTypeButtonDisabled(n,!1),t=this._map.getView(),f.BirdseyeV2Manager.getIsBirdseyeV2Available(this._map.getConfig(),t.cameraLocation,0,function(t){t&&i.setMapTypeButtonDisabled(n,!0)},this._map.getViewport()))},r.prototype.exitBirdseyeV2=function(){var t=this;this._map.getBirdseyeV2Manager().then(function(i){t._birdseyeV2NotAvailableTip&&t._birdseyeV2NotAvailableTip.add_class("bm_birdseyeV2ReminderHidden");window.clearTimeout(t._birdseyeV2TipAutoFade);t.setMapType(i.previousMapState.mapTypeId||n.road);t.handleLabelsVisibleOnMapTypeChanged()})},r.prototype.updateNavBarForBirdseyeV2=function(n){var r=this._navigationBar.getRootElement().select(".NavBar_MapTypeButtonContainer"),u=this._navigationBar.getBirdseyeV2InfoExitControl(),t=u&&u.getBirdseyeV2ExitButton(),i="BirdseyeV2MapTypeButton";this.getNavBarOrientation()===ot.vertical&&this.getNavBarMode()===d["default"]||(i+="ReducedSize");n?(this._navigationBar.getRootElement().select(".birdseyeV2Geochain").set_text(""),r.add_class(i),t&&t.updateHandler(!0),this.updateLabelToggleForBirdseyeV2(null,!0)):(r.remove_class(i),t&&t.updateHandler(!1))},r.prototype.updateLabelToggleForBirdseyeV2=function(n,t){var f=typeof n=="boolean"?n:this.getLabelVisible(),u;if(t){var e=this.getMap().getView().cameraLocation,o=new ct(new h(31.461471801529147,135),45,19.03685253618196),s=new ct(new h(48.378235544143905,146.25),22.5,14.796674949047564),r=" disabled",i=this._navigationBar.getRootElement().select(".be2LabelToggleContainer")[0];o.contains(e)||s.contains(e)?(i.className.indexOf(r)<0&&(i.className+=r),f=!1):i.className=i.className.replace(r,"")}u=this._navigationBar.getRootElement().select("#be2ToggleInput")[0];u&&(u.checked=f)},r.prototype.showBirdseyeV2NotAvailableTip=function(n){var h=this,o="bm_birdseyeV2ReminderHidden",s,i,r,u,f;this._birdseyeV2NotAvailableTip?(this._birdseyeV2NotAvailableTip.select(".bm_primaryMessage").set_text(n?t.L_NavBarBirdseyeV2NotAvailableRotationTip_PrimaryText:t.L_NavBarBirdseyeV2NotAvailableTip_PrimaryText),this._birdseyeV2NotAvailableTip.select(".bm_secondaryMessage").set_text(n?"":t.L_NavBarBirdseyeV2NotAvailableTip_SecondaryText),this._birdseyeV2NotAvailableTip.remove_class(o),window.clearTimeout(this._birdseyeV2TipAutoFade)):(s="bm_birdseyeV2NotAvailableTooltips birdseyeV2Tooltips",i=e._createElement("div").set_attr("class",s),this._birdseyeV2NotAvailableTip=i,r=e._createElement("div").set_attr("class","bm_birdseyeV2NotAvailableTooltipsMessage"),u=e._createElement("div").set_attr("class","bm_primaryMessage"),u.set_text(n?t.L_NavBarBirdseyeV2NotAvailableRotationTip_PrimaryText:t.L_NavBarBirdseyeV2NotAvailableTip_PrimaryText),f=e._createElement("div").set_attr("class","bm_secondaryMessage"),f.set_text(n?"":t.L_NavBarBirdseyeV2NotAvailableTip_SecondaryText),r.append(u).append(f),i.append(r),this._navigationBar.getRootElement().getParent().append(i));this._birdseyeV2TipAutoFade=Microsoft.Maps.setTimeout(function(){h._birdseyeV2NotAvailableTip.add_class(o)},2e3)},r.prototype.getIsBirdseyeV2FullControl=function(){var n=this.getNavBarMode();return(n===d["default"]||n===d.square)&&this.getNavBarOrientation()===ot.vertical},r.prototype.getIsBirdseyeV2ControlNewLayout=function(){return i.isMapsVertical||i.isSDK&&this.getNavBarMode()===d.square},r.prototype._adjustSlotText=function(){var f,t,n,a,s;if(this.getMap().getMapOptions().navigationBarMode!=d.compact)for(f=this._mapRoot.select("#RadialMenu")[0].children,t=0,t;t0&&l/40){var y=o+s,p=(l-2-y)/2,h=u(n).get_style("marginTop"),r=Number(h.match("\\d{2}")[0]),v=r-p,c=(r-v).toString().split(".")[0];u(n).set_style({marginTop:Number(c)});h=u(i).get_style("marginTop");r=Number(h.match("\\d{2}")[0]);c=(r-v).toString().split(".")[0];u(i).set_style({marginTop:Number(c)})}}}},r.prototype._disposeMapEvents=function(){e._clearDisposables(this._disposables)},r.prototype._zoomAroundCenterByDelta=function(n){var t=this._map,i=t.getMode(),f=t.getTargetView(),r=k.getViewportCenter(t),u=i.tryPointToLocation(r),e=i.getMapViewZoomedAboutLocation(f,u,n,1);t.setView(e,new uu(t,u,r),1)},r.prototype._log=function(n){var t=this._map.getView(),i={feature:"MC",action:ht.ActionName,data:{EL:n,CP:t.cameraLocation,H:t.heading,MM:this._map.getMode().getDisplayName(),MS:this._map.getMapType().displayName}};g.invokeHandler(w.instrumentationDataHandlerKey,{logData:i})},r.prototype._onMapModeChanged=function(n){n.oldMode===2&&this.streetSideExitEvent.invoke()},r.prototype._onMapTypeChanged=function(){if(this._map.getMapType().id===n.birdseye){this.enableStreetsideButton(!1);var t=this._getStreetsideButton();t.remove_class(r.selectedClass)}else this.enableStreetsideButton(!0)},r.prototype.isStreetsideSupported=function(){return l&&l.isEnabled},r.prototype.isStreetsideButtonEnabled=function(){return this._isStreetsideButtonEnabled},r.prototype.getLabelVisible=function(){return this._isLabelVisible},r.prototype.setLabelVisible=function(n){this._isLabelVisible=n},r.prototype.enableStreetsideButton=function(n){var t=this._getStreetsideButton();n?this._isStreetsideButtonEnabled||this.setMapTypeButtonDisabled(t,!0):this._isStreetsideButtonEnabled&&this.setMapTypeButtonDisabled(t,!1);this._isStreetsideButtonEnabled=n},r.prototype.setMapTypeButtonDisabled=function(n,t){t?(n.remove_class("disabled"),n.set_attr("tabindex","0")):(n.remove_class(r.selectedClass),n.add_class("disabled"),n.set_attr("tabindex","-1"))},r.prototype.enableLabelToggleButton=function(n){var r=this._navigationBar.getRootElement(),u=r.select("#navbarLabelToggleInput"),i=u.getParent().getParent();n?(i.remove_class("disabled"),i.set_attr("tabindex","0"),i.set_attr("aria-hidden","false"),i.set_attr("aria-label",t.L_RadialMenuLabelToggleEnabled_Text)):(i.add_class("disabled"),i.set_attr("tabindex","-1"),i.set_attr("aria-hidden","true"),i.set_attr("aria-label",t.L_RadialMenuLabelToggleDisabled_Text))},r.prototype.isBirdseyeSupported=function(){var n=i.features.birdseye;return!!(n&&n.isEnabled)},r.prototype.enableBirdseyeButton=function(){var n=this._navigationBar.getRootElement();this.isBirdseyeSupported()?(n.select(".NavBar_Container .birdseye").remove_class("disabled"),n.select(".NavBar_Container .birdseye").set_attr("tabindex","0")):(n.select(".NavBar_Container .birdseye").add_class("disabled"),n.select(".NavBar_Container .birdseye").set_attr("tabindex","-1"))},r.prototype._onWindowEvent=function(n){n instanceof KeyboardEvent&&n.keyCode!==13&&n.keyCode!==27||(n.keyCode==27?(this.isDropDownShowing()&&this.isSwitchButtonTurnedOn(this._getStreetsideButton())&&n.stopImmediatePropagation(),this.hideDropDownMenu()):this.checkHideDropDownMenu(n.target))},r.prototype.checkHideDropDownMenu=function(n){n&&(this.dropDownMenu||(this.dropDownMenu=this._mapRoot.select("#RadialMenu")[0]),this.mapStyleSelector||(this.mapStyleSelector=this._mapRoot.select("#MapStyleSelector")[0]),this.mapStyleSelector&&this.mapStyleSelector.id!=n.id&&!this.mapStyleSelector.contains(n)&&this.dropDownMenu.id!=n.id&&!this.dropDownMenu.contains(n)&&this.isDropDownShowing()&&this.hideDropDownMenu())},r.prototype._getStreetsideButton=function(){if(this.streetsideButton)return this.streetsideButton;var n=this._mapRoot.select(".slot.streetside");return n.length>0&&(this.streetsideButton=n),n},r.prototype._setRotateButtonVisible=function(n){var t=this._map.getNavigationBar();t&&t.setRotateButtonVisible(n)},r.prototype._handleLocateMeEvent=function(n){var i,t;typeof SHwlochelper!="undefined"&&SHwlochelper&&n&&n.location&&(i=f.Internal._CoreConfig(),i.writeUserLocCookie&&(t="",n.error?n.error===1&&SHwlochelper.writeBlockLocation(t,"maps",function(){},function(){}):SHwlochelper.writeDeviceLocation({coords:{accuracy:n.accuracy,latitude:n.location.latitude,longitude:n.location.longitude}},t,"maps",function(){},function(){})),this._map.onLocateMeEvent&&this._map.onLocateMeEvent.invoke(n))},r._locateMeMinZoom=12,r._locateMeMaxZoom=17,r.selectedClass="selected",r}(),ho=function(){function t(n,t,i,r){var u=this,f;this._map=n;this._mapElement=n.getRootElement()[0];this._aerialBirdsEyeTransitionManager=i;this._options={enabledInteractionModes:65535,moveThreshold:3,tapThreshold:10,doubleTapThreshold:20,doubleTapTimeThreshold:500,autoRepeatDelay:1e3,autoRepeatTimerInterval:32,singlePanDistance:200,repeatPanDistance:20,singleZoomDistance:1,repeatZoomDistance:.05,maximumInitialLinearInertiaSpeed:1.41,maximumInitialExpansionInertiaSpeed:.07,maximumInitialAngularInertiaSpeed:.04};r&&this.setOptions(r);this._keyboardState=new oo;this._activePointers=new kf;this._previousManipulationDeltaTrail=new eo;this._inertia=new ro(function(n,t,i){u._inertiaCallback(n,t,i)});this._previousTapTimestamp=0;this._coreConfig=t;this._resetStateToAwaitingInput();this._zoomDelta=0;this._zoomDeltaMax=0;this._zoomDeltaLatestMin=0;this._zoomDeltaPrevious=0;this._previousZoomTimestamp=0;this._disposables=[];this._map.viewChanged.add(function(){u._resetWheelDeltaAccumulator()});f=this._coreConfig.smoothWheel?function(n){return u._zoomOnPointerWheelChangedEnhanced(n)}:function(n){return u._zoomOnPointerWheelChanged(n)};this._pointerWheelChanged=new tt;this._disposables.push(this._pointerWheelChanged.addThrottled(f,75,function(n,t){return u._filterPointerWheelChanged(n,t)}));this._disposables.push(this._map.interactionModeUpdated.add(function(){u._updateMapInteractionModes()}));this._updateMapInteractionModes()}return t.prototype.dispose=function(){e._clearDisposables(this._disposables);clearTimeout(this._hoverDelayTimerId);clearTimeout(this._tapAndHoldTimerId);this._releasePointerCapture()},t.prototype.setOptions=function(n){function t(n,t,i){typeof t[n]!="undefined"&&(i[n]=t[n])}var i=this._options;t("disableAllInteractions",n,i);t("enabledInteractionModes",n,i);t("moveThreshold",n,i);t("tapThreshold",n,i);t("doubleTapTimeThreshold",n,i);t("autoRepeatDelay",n,i);t("autoRepeatTimeInterval",n,i);t("singlePanDistance",n,i);t("repeatPanDistance",n,i);t("singleZoomDistance",n,i);t("repeatZoomDistance",n,i);t("maximumInitialLinearInertiaSpeed",n,i);t("maximumInitialExpansionInertiaSpeed",n,i);t("maximumInitialAngularInertiaSpeed",n,i)},t.prototype.disableInteractionModes=function(n){var t=this._options;t.enabledInteractionModes=t.enabledInteractionModes&~n},t.prototype.enableInteractionModes=function(n){var t=this._options;t.enabledInteractionModes=t.enabledInteractionModes|n},t.prototype.getOptions=function(){return this._options},t.prototype.setInertiaOptions=function(n){this._inertia.setOptions(n)},t.prototype.getInertiaOptions=function(){return this._inertia.getOptions()},t.prototype.onKeyDown=function(n){var r=this,t,i;return(this._map.keyPressed.invoke(n),!this._verifyInteractionsAreEnabled()||this._map.getMapOptions().disableKeyboardInput)?!1:(this._keyboardState.processKeyDownEvent(n),t=this._getActiveKeyboardState(this._keyboardState),i=t!==0,i&&(this._state===0||this._state===10)&&(this._state=3,(t===32||t===8)&&(this._keyAutoRepeatTimerId=Microsoft.Maps.setTimeout(function(){return r._onKeyAutoRepeatTimer()},this._options.autoRepeatDelay))),i)},t.prototype.onKeyUp=function(n){this._map.keyReleased.invoke(n);var t=this._getActiveKeyboardState(this._keyboardState),i=t!==0;if(i&&this._state===3){this._captureKeyboardNavProperties();switch(t){case 32:this._raisePanStartedEvent(this._keyboardNavPreviousCenterPoint,this._keyboardNavPreviousCenterLocation);this._applyKeyboardPanOperation(this._options.singlePanDistance,null);this._raisePanStoppedEvent(this._keyboardNavPreviousCenterPoint,this._keyboardNavPreviousCenterLocation);break;case 8:this._applyKeyboardZoomOperation(this._options.singleZoomDistance,1);break;case 1024:this._applyMapTypeSwitchOperation()}this._resetStateToAwaitingInput()}return this._keyboardState.processKeyUpEvent(n),i},t.prototype._getActiveKeyboardState=function(n){var t=0,i=this._map.getMapOptions();return!this._verifyInteractionsAreEnabled()||i.disableKeyboardInput?t:(!i.disablePanning&&this._isModeEnabled(32)&&n.isPanOperationRequested()?t=32:!i.disableZooming&&this._isModeEnabled(8)&&n.isZoomOperationRequested()?t=8:this._isModeEnabled(1024)&&n.isMapTypeSwitchRequested()&&(t=1024),t)},t.prototype._getMouseEventArgs=function(n,t){var i=t,r=f.MouseEventArgs;return r&&(i=new r(n,this._map,t)),i},t.prototype.onPointerEntered=function(n){(this._state===0||this._state===10)&&this._updateHoverState(n);this._map.pointerEntered.invoke(this._getMouseEventArgs("mouseover",n))},t.prototype.onPointerExited=function(n){this._updateHoverState(n);this._map.pointerExited.invoke(this._getMouseEventArgs("mouseout",n))},t.prototype.onPointerMoved=function(n){var t=n[0],e,f,i,r;if(t.buttonsState===0&&(e=u.Browser.is_ie&&u.Browser.ie_version===10,this._state===7||this._state===8||this._state===9&&!e||this._state===6)){t.button=1;t.buttonsState=1;try{this.onPointerReleased(t)}catch(o){this._resetStateToAwaitingInput();throw o;}return}if(this._map.pointerMoved.invoke(this._getMouseEventArgs("mousemove",t)),f=this._activePointers.getItem(t.identifier),f){i=f.get(0);this._updatePointerTrail(n);switch(this._state){case 1:y.getEuclideanDistance2D(t.point,i.point)>this._options.moveThreshold&&(i.primitive&&i.primitive.isMoveEnabled&&i.primitive.isMoveEnabled()&&this._isModeEnabled(512)?(this._state=9,this._raisePrimitiveMoveStartedEvent(t.point,t.location,i)):!this._map.getMapOptions().disablePanning&&this._isModeEnabled(16)?(this._state=8,this._raisePanStartedEvent(t.point,t.location),this._panMapToPoint(i.location,t.point,!0)):this._updateHoverState(t));break;case 2:a.assert(this._activePointers.getCount()>1,"One or fewer pointers being tracked");this._state=6;this._manipulationStartPoint=null;clearTimeout(this._tapAndHoldTimerId);r=this._createManipulationEventArgs(t.timestamp);this._raiseManipulationStartedEvent(r);break;case 7:this._raiseBoxZoomContinuedEvent(t.point,t.location);break;case 8:this._panMapToPoint(i.location,t.point,!0);this._raisePanContinuedEvent(t.point,t.location);break;case 9:this._raisePrimitiveMoveContinuedEvent(t.point,t.location,i);break;case 6:r=this._createManipulationEventArgs(t.timestamp);this._raiseManipulationContinuedEvent(r)}}else(this._state===0||this._state===10)&&this._updateHoverState(t)},t.prototype.onPointerPressed=function(n){if(this._verifyInteractionsAreEnabled()&&(n.originalArgs&&!n.originalArgs.isTrusted?this._previousUntrustedEventArgs=n:(this._previousUntrustedEventArgs&&this._previousUntrustedEventArgs.pointerType!==n.pointerType&&this._resetStateToAwaitingInput(),this._previousUntrustedEventArgs=null),this._map.pointerPressed.invoke(this._getMouseEventArgs("mousedown",n)),this._state===11&&this._resetStateToAwaitingInput(),this._isPointerEventTargetingMe(n)&&(this._activePointerType===0||this._activePointerType===n.pointerType)&&this._activePointers.getCount()<=2)){if(this._activePointers.getItem(n.identifier)){this._state===7&&this._raiseBoxZoomCanceledEvent();this._resetStateToAwaitingInput();return}this._activePointerType=n.pointerType;var t=new go;t.add(n);this._activePointers.addItem(n.identifier,t);this._state===0?this._allowBoxZoom()&&(n.button===4||n.originalArgs.shiftKey)?(this._state=7,this._raiseBoxZoomStartedEvent(n.point,n.location),this._acquirePointerCapture()):n.button===1&&(this._state=1,(n.pointerType===4||n.pointerType===3)&&this._watchForTapAndHold(),this._acquirePointerCapture(),(this._isPrimitiveTapEnabled(n.primitive,!1)||this._isPrimitiveTapEnabled(n.primitive,!0))&&this._raisePrimitivePointerPressedEvent(n.point,n.location,n)):(this._state===1||this._state===8)&&n.button===1?(this._trimPointers(),this._state=2):this._state===7&&(this._raiseBoxZoomCanceledEvent(),this._resetStateToAwaitingInput())}},t.prototype._updatePointerTrail=function(n){for(var i,t=0;t.7||i>0&&t>0&&ti||(t=t/u,k.zoomAroundLocation(r,n.location,t,!0,1,1))},t.prototype._zoomOnPointerWheelChangedEnhanced=function(n){var u=this._map,l=et.fromLocation(u.getView().cameraLocation,!0),a=et.fromLocation(u.getTargetView().cameraLocation,!0),r=a-l,i=n.wheelDelta/2,t=Math.abs(i),v=Math.abs(this._zoomDeltaPrevious),f=t<.5,e,o,s,h,c;f?this._zoomDelta+=i:this._resetWheelDeltaAccumulator();e=n.timestamp;o=e-this._previousZoomTimestamp;this._previousZoomTimestamp=e;var y=Math.abs((this._zoomDeltaMax-this._zoomDeltaLatestMin)/this._zoomDeltaMax),p=Math.abs((t-this._zoomDeltaLatestMin)/this._zoomDeltaMax),w=Math.abs((t-this._zoomDeltaPrevious)/t);if(this._zoomDeltaPrevious=t,s=o>225,h=i<.005,s&&!h&&this._resetWheelDeltaAccumulator(),f)if(this._zoomDeltaMax>0){var b=p>=.25,d=t>v,g=w>.45,nt=y>=.5;b&&d&&g&&nt&&this._resetWheelDeltaAccumulator();this._zoomDeltaLatestMin=Math.min(t,this._zoomDeltaLatestMin);t>this._zoomDeltaMax&&(this._zoomDeltaMax=t,this._zoomDeltaLatestMin=t)}else this._zoomDeltaMax=t;(c=this._zoomDelta===0,!t||Math.abs(r)>.7||r>0&&i>0&&ir||f&&!c&&t<.8)||(i=i/t,k.zoomAroundLocation(u,n.location,i,!0,1,1))},t.prototype._resetWheelDeltaAccumulator=function(){this._zoomDelta=0;this._zoomDeltaMax=0;this._zoomDeltaLatestMin=0;this._zoomDeltaPrevious=0},t.prototype._filterPointerWheelChanged=function(n,t){return t.wheelDelta=t.wheelDelta/2+n.wheelDelta,t},t.prototype.onPointerWheelChanged=function(n){this._map.pointerWheelChanged.invoke(this._getMouseEventArgs("mousewheel",n));var t=!this._verifyInteractionsAreEnabled()||!this._isModeEnabled(4)||this._map.getMapOptions().disableZooming;t||(n.originalArgs.preventDefault(),n.originalArgs.stopPropagation(),this._pointerWheelChanged.invoke(n))},t.prototype.onContextMenuInvoked=function(n){this._raiseContextMenuInvokedEvent(n.point,n.location,n);this._resetStateToAwaitingInput()},t.prototype._panMapToPoint=function(n,t,i){var r=this._map.getTargetView(),u=this._map.getMode().getCameraForLocationToPoint(n,t,r.cameraLocation.altitude,0);u&&this._map.setView(new lt(u,r.heading),null,i?2:1,!i)},t.prototype._panMapToSpecificPoint=function(n,t,i){var u=this._map.getMode().tryPointToLocation(n),r=this._map.getMode().getCameraForLocationToPoint(u,t,this._map.getView().cameraLocation.altitude,0),f=this._map.getTargetView();r&&this._map.setView(new lt(r,f.heading),i,1)},t.prototype._applyManipulationToMap=function(n,t){var h=this._map.getMode(),u=this._map.getMapOptions(),c=y.getVectorSum2D(n.point,n.cumulative.translation),o=this._manipulationStartLocation,f=0,l=0,a=null,v=this._map.getTargetView(),s=v,i,e,r,p,w,b;if(!u.disableZooming){var k=et.fromLocation(this._manipulationStartView.cameraLocation,!0),d=et.fromLocation(this._map.getView().cameraLocation,!0),g=(this._manipulationStartLength+n.cumulative.expansion)/this._manipulationStartLength,nt=y.log2(g),tt=k+nt;if(f=tt-d,t&&(a=new uu(this._map,o,c),l=1,i=this._previousManipulationDeltaTrail.getLastN(4),i&&i.length>1)){for(e=0,r=1;r0?f+=.5:e<0&&(f-=.5)}}u.disablePanning&&u.disableZooming||(p=u.disablePanning?h.tryLocationToPoint(o):c,s=h.getMapViewZoomedAboutLocationAtPoint(v,o,p,f,l));w=this._manipulationStartView.heading;b=w+n.cumulative.rotation;s.heading=b;this._map.setView(s,a,t?1:2)},t.prototype._updateHoverState=function(n){var r=this,t=n.primitive,u=n.hitTarget;if(this._isHoverEnabled(t)||(t=null,u=null),this._previousHoverTarget!==u||this._previousHoverPrimitive!==t){this._changeCursor(t,!!t);this._previousHoverTarget=u;this._previousHoverPrimitive=t;clearTimeout(this._hoverDelayTimerId);var i=this._activeHoverArgs,f=i&&i.primitive,e=i&&i.hitTarget;(t!==f||u!==e)&&(f&&!f.isDisposed&&this._raisePrimitiveHoverStoppedEvent(n.point,n.location,i),t?this._hoverDelayTimerId=Microsoft.Maps.setTimeout(function(){r._isHoverEnabled(t)?(r._activeHoverArgs=n,r._raisePrimitiveHoverStartedEvent(n.point,n.location,n)):r._activeHoverArgs=null},this._coreConfig.primitivesHoverDelay):this._activeHoverArgs=null)}},t.prototype._resetStateToAwaitingInput=function(){this._inertia.stop();this._state=0;this._activePointers.clear();this._activePointerType=0;this._previousManipulationDeltaTrail.clear();this._manipulationStartPoint=null;this._manipulationStartView=null;this._releasePointerCapture();this._resetKeyboardState();this._previousUntrustedEventArgs=null},t.prototype._resetKeyboardState=function(){this._keyboardState.reset();this._keyAutoRepeatTimerId&&(clearTimeout(this._keyAutoRepeatTimerId),this._keyAutoRepeatTimerId=null)},t.prototype._createManipulationEventArgs=function(n){var o=this._activePointers.getAt(0),s=this._activePointers.getAt(1),t=o.get(0),u=s.get(0),h,i;this._manipulationStartPoint||(h=this._manipulationStartView=this._map.getView(),this._manipulationStartPoint=y.getMidpoint2D(t.point,u.point),this._manipulationStartLocation=this._map.getMode().tryPointToLocation(this._manipulationStartPoint,h),this._manipulationStartLength=y.getEuclideanDistance2D(t.point,u.point),this._manipulationStartAngle=y.getAngleOfVector2D(y.getVectorDifference2D(t.point,u.point)));var f=o.getLast(),e=s.getLast(),p=y.getMidpoint2D(f.point,e.point),w=y.getEuclideanDistance2D(f.point,e.point),b=y.getAngleOfVector2D(y.getVectorDifference2D(f.point,e.point)),c=y.getVectorDifference2D(p,this._manipulationStartPoint),l=w-this._manipulationStartLength,a=-((b-this._manipulationStartAngle)*y.degreesPerRadian),r=new pi(l,a,c);this._previousManipulationDeltaTrail.isEmpty()&&(this._previousManipulationDeltaTrail.add(r),this._previousManipulationTimestamp=n);i=this._previousManipulationDeltaTrail.getLastExcluding(r);i||(i=r);var v=new pi(l-i.expansion,a-i.rotation,y.getVectorDifference2D(c,i.translation)),k=n-this._previousManipulationTimestamp,d=this._calculateManipulationVelocities(v,k),g={point:this._manipulationStartPoint,location:this._map.getMode().tryPointToLocation(this._manipulationStartPoint),primitive:t.primitive,layer:t.layer,exclusiveHitTest:t.exclusiveHitTest,cumulative:r,delta:v,isInertial:!1,velocities:d};return this._previousManipulationDeltaTrail.add(r),this._previousManipulationTimestamp=n,g},t.prototype._allowBoxZoom=function(){var i=this._map,r,n,t;return i.getMapOptions().disableZooming||!this._isModeEnabled(1)?!1:(r=i.getMapOptions().navigationOptions,n=!0,r&&r.lockCameraAltitude?n=!1:(t=i.getMode(),n=!!t.allowBoxZoom,typeof t.allowBoxZoom=="function"&&(n=t.allowBoxZoom())),n)},t.prototype._raiseBoxZoomStartedEvent=function(n,t){this._map.boxZoomStarted.invoke({point:n,location:t})},t.prototype._raiseBoxZoomContinuedEvent=function(n,t){this._map.boxZoomContinued.invoke({point:n,location:t})},t.prototype._raiseBoxZoomStoppedEvent=function(n,t){this._map.boxZoomStopped.invoke({point:n,location:t})},t.prototype._raiseBoxZoomCanceledEvent=function(){this._map.boxZoomCancelled.invoke()},t.prototype._raiseMapTappedEvent=function(n,t,i,r){var u=r?this._map.mapDoubleTapped:this._map.mapTapped,f={point:n,location:t,exclusiveHitTest:i.exclusiveHitTest,originalArgs:i.originalArgs};u.invoke(this._getMouseEventArgs(r?"dblclick":"click",f))},t.prototype._raisePrimitiveHoverStoppedEvent=function(n,t,i){var r=i.primitive,u=i.layer,f={point:n,location:t,primitive:r,hitTarget:i.hitTarget,layer:u,exclusiveHitTest:i.exclusiveHitTest},e=this._getMouseEventArgs("mouseout",f);this._map.primitiveHoverStopped.invoke(f);u&&u.primitiveHoverStopped&&u.primitiveHoverStopped.invoke(e);r&&r.mouseout&&r.mouseout.invoke(e)},t.prototype._raisePrimitiveHoverStartedEvent=function(n,t,i){var r=i.primitive,u=i.layer,f={point:n,location:t,primitive:r,hitTarget:i.hitTarget,layer:u,exclusiveHitTest:i.exclusiveHitTest},e=this._getMouseEventArgs("mouseover",f);this._map.primitiveHoverStarted.invoke(f);u&&u.primitiveHoverStarted&&u.primitiveHoverStarted.invoke(e);r&&r.mouseover&&r.mouseover.invoke(e)},t.prototype._changeCursor=function(n,t){var i=n&&n.getCursor?n.getCursor():"pointer";this._map.getRootElement().set_style({cursor:t?i:""})},t.prototype._isPrimitiveTapEnabled=function(n,t){var i=!!n;return t?i&&n.isDoubleTapEnabled&&n.isDoubleTapEnabled()&&this._isModeEnabled(256):i&&n.isTapEnabled&&n.isTapEnabled()&&this._isModeEnabled(128)},t.prototype._raisePrimitivePointerPressedEvent=function(n,t,i){var r=i.primitive,u=i.layer,f=this._getMouseEventArgs("mousedown",{point:n,location:t,primitive:r,hitTarget:i.hitTarget,layer:u,exclusiveHitTest:i.exclusiveHitTest,originalArgs:i.originalArgs});u&&u.primitivePointerPressed&&u.primitivePointerPressed.invoke(f);r&&r.mousedown&&r.mousedown.invoke(f)},t.prototype._raisePrimitivePointerReleasedEvent=function(n,t,i){var r=i.primitive,u=i.layer,f=this._getMouseEventArgs("mouseup",{point:n,location:t,primitive:r,hitTarget:i.hitTarget,layer:u,exclusiveHitTest:i.exclusiveHitTest,originalArgs:i.originalArgs});u&&u.primitivePointerReleased&&u.primitivePointerReleased.invoke(f);r&&r.mouseup&&r.mouseup.invoke(f)},t.prototype._raisePrimitiveTappedEvent=function(n,t,i,r){var u=i.primitive,f=i.layer,o={point:n,location:t,primitive:u,hitTarget:i.hitTarget,layer:f,exclusiveHitTest:i.exclusiveHitTest,originalArgs:i.originalArgs},e=this._getMouseEventArgs(r?"dblclick":"click",o);r?(this._map.primitiveDoubleTapped.invoke(o),f&&f.primitiveDoubleTapped&&f.primitiveDoubleTapped.invoke(e),u&&u.dblclick&&u.dblclick.invoke(e)):(this._map.primitiveTapped.invoke(o),f&&f.primitiveTapped&&f.primitiveTapped.invoke(e),u&&u.click&&u.click.invoke(e))},t.prototype._raisePrimitiveMoveStartedEvent=function(n,t,i){var r=i.primitive,u=i.layer,f={point:n,location:t,primitive:r,layer:u,exclusiveHitTest:i.exclusiveHitTest};r&&r.dragstart&&r.dragstart.invoke(this._getMouseEventArgs("dragstart",f));this._map.primitiveMoveStarted.invoke(f);u&&u.primitiveMoveStarted&&u.primitiveMoveStarted.invoke(f)},t.prototype._raisePrimitiveMoveContinuedEvent=function(n,t,i){var r=i.primitive,u=i.layer,f={point:n,location:t,primitive:r,layer:u,exclusiveHitTest:i.exclusiveHitTest};this._map.primitiveMoveContinued.invoke(f);u&&u.primitiveMoveContinued&&u.primitiveMoveContinued.invoke(f);r&&r.drag&&r.drag.invoke(this._getMouseEventArgs("drag",f))},t.prototype._raisePrimitiveMoveStoppedEvent=function(n,t,i){var r=i.primitive,u=i.layer,f={point:n,location:t,primitive:r,layer:u,exclusiveHitTest:i.exclusiveHitTest};this._map.primitiveMoveStopped.invoke(f);u&&u.primitiveMoveStopped&&u.primitiveMoveStopped.invoke(f);r&&r.dragend&&r.dragend.invoke(this._getMouseEventArgs("dragend",f))},t._manipulationTargetsPrimitive=function(n){return n.primitive&&n.primitive.isManipulationEnabled&&n.primitive.isManipulationEnabled()},t.prototype._raiseManipulationStartedEvent=function(n){t._manipulationTargetsPrimitive(n)?(this._map.primitiveManipulationStarted.invoke(n),n.layer&&n.layer.primitiveManipulationStarted&&n.layer.primitiveManipulationStarted.invoke(n)):(this._applyManipulationToMap(n),this._map.mapManipulationStarted.invoke(n))},t.prototype._raiseManipulationContinuedEvent=function(n){t._manipulationTargetsPrimitive(n)?(this._map.primitiveManipulationContinued.invoke(n),n.layer&&n.layer.primitiveManipulationContinued&&n.layer.primitiveManipulationContinued.invoke(n)):(this._applyManipulationToMap(n),this._map.mapManipulationContinued.invoke(n))},t.prototype._raiseManipulationStoppedEvent=function(n){t._manipulationTargetsPrimitive(n)?(this._map.primitiveManipulationStopped.invoke(n),n.layer&&n.layer.primitiveManipulationStopped&&n.layer.primitiveManipulationStopped.invoke(n)):(this._applyManipulationToMap(n,!0),this._map.mapManipulationStopped.invoke(n))},t.prototype._raiseContextMenuInvokedEvent=function(n,t,i){var f=i.primitive,r=i.layer,e={point:n,location:t,primitive:f,hitTarget:i.hitTarget,layer:r,exclusiveHitTest:i.exclusiveHitTest,originalArgs:i.originalArgs},u=this._getMouseEventArgs("rightclick",e);this._map.contextMenuInvoked.invoke(u);r&&r.contextMenuInvoked&&r.contextMenuInvoked.invoke(u)},t.prototype._raisePanStartedEvent=function(n,t){this._map.mapPanStarted.invoke({point:n,location:t})},t.prototype._raisePanContinuedEvent=function(n,t){this._map.mapPanContinued.invoke({point:n,location:t})},t.prototype._raisePanStoppedEvent=function(n,t){this._map.mapPanStopped.invoke({point:n,location:t})},t.prototype._inertiaCallback=function(n,t,i){this._map&&!this._map.isDisposed()&&t&&(n?this._processLinearInertia(n,t[0],i):this._doPostLinearInertiaWork(t[0]))},t.prototype._processLinearInertia=function(n,t,i){var r=t.get(0),o=t.getLast(),s=new p(n.linearVelocity.x*i,n.linearVelocity.y*i),u=y.getVectorSum2D(o.point,s),e=this._map.getMode().tryPointToLocation(u),f=r.primitive;f&&f.isMoveEnabled&&f.isMoveEnabled()?this._raisePrimitiveMoveContinuedEvent(u,e,r):(this._panMapToPoint(r.location,u,!0),this._raisePanContinuedEvent(u,e));t.add({pointerType:r.pointerType,identifier:r.identifier,point:u,timestamp:Date.now()})},t.prototype._doPostLinearInertiaWork=function(n){var t=n.getLast().point,u=this._map.getMode().tryPointToLocation(t),i=n.get(0),r=i.primitive;r&&r.isMoveEnabled&&r.isMoveEnabled()?this._raisePrimitiveMoveStoppedEvent(t,u,i):(this._panMapToPoint(i.location,t,!1),this._raisePanStoppedEvent(t,u));this._resetStateToAwaitingInput()},t.prototype._calculateManipulationVelocities=function(n,t){var i=null,r=null,u=null;return t>0?(i=n.expansion/t,r=n.rotation/t,u=new p(n.translation.x/t,n.translation.y/t)):(i=0,r=0,u=new p(0,0)),{expansionVelocity:i,angularVelocity:r,linearVelocity:u}},t.prototype._isPointerEventTargetingMe=function(n){for(var t=n.element,r=!1,i;t&&!r;)r=t.className&&t.className.indexOf("ms-composite")!==-1||t.getAttribute("data-events-for")==="ms-composite",r||(t=t.parentElement);if(!r)return!1;for(i=t;i;){if(i.classList.contains("MicrosoftMap"))break;i=i.parentElement}return i!==this._mapElement?!1:!0},t.prototype._captureKeyboardNavProperties=function(){var n=this._map.getActualSize()||{width:0,height:0};this._keyboardNavPreviousCenterPoint=new p(n.width/2,n.height/2)},t.prototype._applyKeyboardPanOperation=function(n,t){var i=new p(this._keyboardNavPreviousCenterPoint.x,this._keyboardNavPreviousCenterPoint.y);this._keyboardState.isPanUpRequested()&&(i.y+=n);this._keyboardState.isPanDownRequested()&&(i.y-=n);this._keyboardState.isPanLeftRequested()&&(i.x+=n);this._keyboardState.isPanRightRequested()&&(i.x-=n);this._panMapToSpecificPoint(this._keyboardNavPreviousCenterPoint,i,t);this._keyboardNavPreviousCenterPoint=i;this._keyboardNavPreviousCenterLocation=this._map.getMode().tryPointToLocation(i)},t.prototype._applyKeyboardZoomOperation=function(n,t){var i=0,e;this._keyboardState.isZoomInRequested()?i=n:this._keyboardState.isZoomOutRequested()&&(i=-n);var r=this._map,u=this._keyboardNavPreviousCenterPoint.clone(),f=k.getViewportCenterOffset(r);u.x+=f.width;u.y+=f.height;e=r.getMode().tryPointToLocation(u);k.zoomAroundLocation(r,e,i,!0,1,t)},t.prototype._applyMapTypeSwitchOperation=function(){var o=this._map.getNavigationBar(),t,r=n.none,s=this._map.getMapType().id,u=!0,l,c,h,a;(o&&(t=o.getHelper(),s=t.getMapType(),u=t.getLabelVisible()),this._keyboardState.isKeyPressed(82)&&s!==n.road?r=n.road:this._keyboardState.isKeyPressed(65)||this._keyboardState.isKeyPressed(72)?(r=n.aerial,u=this._keyboardState.isKeyPressed(72)):this._keyboardState.isKeyPressed(79)||this._keyboardState.isKeyPressed(66)?this._map.getMapOptions().disableBirdseye||(l=i.isMapsVertical&&!e._isFeatureEnabled("birdseyeV2UI"),r=l?n.birdseye:n.birdseyeV2,u=this._keyboardState.isKeyPressed(66)):this._keyboardState.isKeyPressed(83)&&(r=n.ordnanceSurvey),c=this._map.createMapType(r),c.id==r)&&(h=!0,o?(t.isEnabled(o.getRootElement())&&t.hideDropDownMenu(),s!==r?r===n.birdseyeV2?(a=this._map.getView(),f.BirdseyeV2Manager.getIsBirdseyeV2Available(this._map.getConfig(),a.cameraLocation,0,function(n){n?(t.setLabelVisible(!!u),t.setMapType(r),h=t.supportLabelToggle(),t.updateLabelToggleForBirdseyeV2(null,!0)):t.showBirdseyeV2NotAvailableTip(!1)},this._map.getViewport())):(t.setMapType(r),this._aerialBirdsEyeTransitionManager.requestMapType(r),t.setLabelVisible(!!u),h=t.supportLabelToggle()):r===n.birdseyeV2&&(t.setLabelVisible(!!u),t.updateLabelToggleForBirdseyeV2(null,!0))):r!==n.birdseyeV2&&(s!==r&&this._map.setMapType(c),this._aerialBirdsEyeTransitionManager.requestMapType(r)),this._map.getLabelController().setIsLabelsEnabled(h?!!u:!0))},t.prototype._onKeyAutoRepeatTimer=function(){var n=this;this._state===3&&this._keyboardState.isNavigationRequested()&&(this._captureKeyboardNavProperties(),this._keyboardState.isPanOperationRequested()?(this._raisePanStartedEvent(this._keyboardNavPreviousCenterPoint,this._keyboardNavPreviousCenterLocation),this._state=4):this._keyboardState.isZoomOperationRequested()&&(this._state=5),Microsoft.Maps.setTimeout(function(){return n._onKeyRepeatingTimer()},this._options.autoRepeatTimerInterval));this._keyAutoRepeatTimerId=null},t.prototype._onKeyRepeatingTimer=function(){var n=this;this._verifyInteractionsAreEnabled()&&(!this._map.getMapOptions().disablePanning&&this._isModeEnabled(32)&&this._state===4?this._keyboardState.isPanOperationRequested()?(this._applyKeyboardPanOperation(this._options.repeatPanDistance,null),this._raisePanContinuedEvent(this._keyboardNavPreviousCenterPoint,this._keyboardNavPreviousCenterLocation),Microsoft.Maps.setTimeout(function(){return n._onKeyRepeatingTimer()},this._options.autoRepeatTimerInterval)):(this._raisePanStoppedEvent(this._keyboardNavPreviousCenterPoint,this._keyboardNavPreviousCenterLocation),this._resetStateToAwaitingInput()):!this._map.getMapOptions().disableZooming&&this._isModeEnabled(8)&&this._state===5&&(this._keyboardState.isZoomOperationRequested()?(this._applyKeyboardZoomOperation(this._options.repeatZoomDistance),Microsoft.Maps.setTimeout(function(){return n._onKeyRepeatingTimer()},this._options.autoRepeatTimerInterval)):this._resetStateToAwaitingInput()))},t.prototype._capLinearVelocity=function(n){var t=y.getMagnitudeOfVector2D(n),i,r;return t<=this._options.maximumInitialLinearInertiaSpeed?n:(t=this._options.maximumInitialLinearInertiaSpeed,i=y.getAngleOfVector2D(n),r=y.getVector2DFromMagnitudeAndDirection(t,i),r)},t.prototype._capManipulationVelocities=function(n){var f=this._capLinearVelocity(n.linearVelocity),i=n.expansionVelocity,e=Math.abs(i),t,u,r;return e>this._options.maximumInitialExpansionInertiaSpeed&&(r=i>0?1:-1,i=this._options.maximumInitialExpansionInertiaSpeed*r),t=n.angularVelocity,u=Math.abs(t),u>this._options.maximumInitialAngularInertiaSpeed&&(r=t>0?1:-1,t=this._options.maximumInitialAngularInertiaSpeed*r),{linearVelocity:f,expansionVelocity:i,angularVelocity:t}},t.prototype._acquirePointerCapture=function(){u.Events.capture_mouse(this._mapElement)},t.prototype._releasePointerCapture=function(){u.Events.release_mouse()},t.prototype._trimPointers=function(){for(var t,r,n=0,i=this._activePointers.getCount();nthis._maxZoomLevel?this._setMapType(n.birdseye):this._setMapType(n.aerial))},t.prototype._setMapType=function(n){this._isActive&&this._map.getMapType().id!==n&&this._map.setBaseLayers(n)},t.DEFAULT_ZOOM_CUT_OFF_FOR_BIRDSEYE_MODE=16,t.DEFAULT_ZOOM_CUT_OFF_FOR_AERIAL_MODE=21,t}(),ut=function(n){function t(t){var i=this,r;return t=t||{},i=n.call(this,null,t)||this,t&&(r=t.helper),i.defineProperty("helper",null,null,{defaultValue:r}),i.defineProperty("style",i.onStyleChanged,i._styleConverter),i.defineProperty("title"),i}return s(t,n),t.prototype._onMouseEnter=function(){var n=this.getHelper();i.isMapsVertical||n.isDropDownShowing()||n.checkBirdseyeV2ForDropdown();n.showDropDownMenu()},t.prototype._onMouseLeave=function(n){var t=this.getHelper();n.toElement?t.checkHideDropDownMenu(n.toElement):t.hideDropDownMenu()},t.prototype._onBlur=function(n){this.getHelper().checkHideDropDownMenu(n.relatedTarget)},t.prototype.boolToVisibility=function(n){return n?"visible":"hidden"},t.prototype.getChildren=function(){var t,n;if(!this._children)for(t=this.getRootElement()[0].childNodes,this._children=[],n=0;n0?(r=''+n.copyrightString+"<\/div>",i.set_style({display:""})):i.set_style({display:"none"});i.set_html(r)}))},r.prototype._instantiateExitButton=function(){var n,t,i;this._birdseyeV2ExitButton||(this._birdseyeV2ExitButton=new cu(this._navBarControlArgs));n=this._isFullControl?this.getRootElement().select(".birdseyeV2InfoExitControl.right"):this.getRootElement();t=this._birdseyeV2ExitButton.getRootElement();this._isNewLayout?n.append(t):(i=this.getRootElement().select(".be2LabelToggleContainer"),n.insertBefore(t,i))},r.prototype._getSelectorTemplate=function(){var t,r="
<\/BirdseyeV2LabelToggle>",u="be2LabelsEnabled",n,f;return this._isFullControl?(n="birdseyeV2InfoExitControl",f=i.isMapsVertical?"birdseyeV2WithTaskBar":"",t=this._isNewLayout?' <\/div>
<\/div> <\/div> <\/div>
<\/div> <\/div>
').concat(r," <\/div> <\/div>"):'
<\/div> <\/div> <\/div>
').concat(r," <\/div> <\/div>")):t="